function [i,j] = index_min(x)

%index of minimum of matrix x
i=1; %row
j=1; %column
rows=length(x(:,1));
columns=length(x(1,:));

for r=1:rows;
    for c=1:columns;
    if x(r,c)<x(i,j);
      i=r;j=c;  
    end;
    end;
end;

end

